package com.chenjiagou.flight.repository;

import com.chenjiagou.flight.model.Flight;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;

import java.util.List;

public interface FlightRepository extends JpaRepository<Flight, Long> {

    // 查询所有航班记录
    List<Flight> findAll();

    Page<Flight> findAll(Pageable pageable);

    // 按出发机场查询航班
    List<Flight> findByDepAirport(String depAirport);

    // 按到达机场查询航班
    List<Flight> findByArrAirport(String arrAirport);

    // 按出发机场和到达机场查询航班
    List<Flight> findByDepAirportAndArrAirport(String depAirport, String arrAirport);
}